{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ca24006b-b592-49c4-a14f-30f573b1bbe8",
   "metadata": {},
   "source": [
    "### 1. 定义问题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f9a93b5e-9484-4201-af59-dfd9c5d477ff",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "ef027fb7-c1bd-4889-8d97-bd416c59c132",
   "metadata": {},
   "outputs": [],
   "source": [
    "def demo(p):\n",
    "    x1, x2 = p\n",
    "    x = np.square(x1) + np.square(x2)\n",
    "    return x - x1 - x2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "43b1d137-86e1-4909-89f9-e22b946caf28",
   "metadata": {},
   "outputs": [],
   "source": [
    "def shaffer(p):\n",
    "    x1, x2 = p\n",
    "    x = np.square(x1) + np.square(x2)\n",
    "    return 0.5 + (np.square(np.sin(x)) - 0.5) / np.square(1 + 0.001 * x)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cb457a5c-17e7-48c0-97fe-f497ed3c41ca",
   "metadata": {},
   "source": [
    "### 2. 运行算法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "8e53760d-bc06-49ba-b21d-7f6945594986",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sko.GA import GA"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "310b5af0-1c57-4b54-bcf6-c0ea5966600d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "best_x: [1. 1.] \n",
      " best_y: [0.]\n"
     ]
    }
   ],
   "source": [
    "ga = GA(func=demo, n_dim=2, size_pop=50, max_iter=100, prob_mut=0.001, lb=[1, 1], ub=[7, 7], precision=[1, 1])\n",
    "best_x, best_y = ga.run()\n",
    "print(\"best_x:\", best_x, \"\\n\", \"best_y:\", best_y)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "096e1d88-2de7-484b-8661-6fa855b20d2b",
   "metadata": {},
   "source": [
    "### 3. 结果可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "1717956c-48e3-4282-bfcf-a026e9518a87",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiMAAAGdCAYAAADAAnMpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8ekN5oAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA5L0lEQVR4nO3dCXxU5b34/28IIQHZZEtYAqTK74KC7EuCFRduIyIF4Vr1jxoRwQUViHXBXvBWi7G1Imopixv2KqK0AkIRLzcgigTCakULglCJQALWEjYJmJz/6/vMnWEmTJJJMjNnZs7n/Xodzpxnzpl55skw851njbMsyxIAAACb1LHriQEAABTBCAAAsBXBCAAAsBXBCAAAsBXBCAAAsBXBCAAAsBXBCAAAsBXBCAAAsFVdiQJlZWVy8OBBadSokcTFxdmdHQAAEACdV/X48ePSpk0bqVOnTnQHIxqIpKam2p0NAABQAwUFBdKuXbvoDka0RsT9Yho3bmx3dgAAQACOHTtmKhPc3+NRHYy4m2Y0ECEYAQAgulTVxYIOrAAAwFbODkY2bRKZMcO1BwAAtoiKZpqQuOMOkTfeOHeclSUyf76dOQIAwJGcWTOiNSHegYjSY2pIAAAIO2cGI5984j/900/DnRMAABzPmcHIT3/qP33gwHDnBAAAx3NmMNK3r6uPiDc91nQAABA9wUhpaalMnTpV0tLSpH79+nLRRRfJU089ZaZ/ddPb06ZNk9atW5tzBg8eLLt37xbbaWfV/HyR55937em8CgBA9I2m+e1vfyuzZ8+WN954Qy699FLZvHmzjBkzRpo0aSIPPvigOed3v/udvPjii+YcDVo0eMnMzJQvv/xSkpKSxFZaE0JtCAAAtoqzvKsxqun666+X5ORkefXVVz1po0aNMjUgb775pqkV0cVxHnroIfn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q37Fjh/lVg+DSZb0nTpwoq1atMh2wEfrAWn8NPv300+ZYa0b0vT1nzhwTjCB43n33XXnrrbdkwYIFcumll8r27dvNjxrtdElZxy5HNtO0aNHCRNzlRxbocUpKim35iiX333+/LF++XNasWSPt2rXzpGv5ajPZ0aNHfc6n7KtHm2EOHz4svXr1Mr9MdFu7dq28+OKL5rb+mqGcg0dHF1xyySU+aV26dJH9+/eb2+4y5TOl9h5++GFTO3LzzTebEUu33XabTJ482YzUU5R1aARSrrrXzx1vP/74oxlhU9uyd2QwolWrvXv3Nu2S3r989Dg9Pd3WvEU77RelgcjixYtl9erVZnieNy33hIQEn7LXob/6oU7ZB+6aa66Rzz//3PxqdG/6y12rst23Kefg0abG8kPUtU9Dhw4dzG19n+uHsXd5a1ODtqNT3tVz6tQp0wfBm/541M9oRVmHRiDlqnv9gaM/htz0c17/Ntq3pFYsBw/t1V7C8+fPNz2Ex48fb4b2FhYW2p21qHbvvfeaoWEfffSRdejQIc926tQpnyGnOtx39erVZshpenq62VA73qNpFOUc3OHTdevWNcNOd+/ebb311ltWgwYNrDfffNNnWKR+hixdutT629/+Zg0fPpzhpjWQlZVltW3b1jO0V4ehtmjRwnrkkUc851DWNR99t23bNrPp1/+MGTPM7W+++SbgctWhvT179jRD3NetW2dG8zG0t5Zeeukl82Gt843oUF8dN43a0Te4v03nHnHTN/Z9991nXXjhheYD/YYbbjABC4IbjFDOwbVs2TKra9eu5kdM586drXnz5vncr0Mjp06daiUnJ5tzrrnmGmvXrl225TdaHTt2zLyP9bM5KSnJ+slPfmLmxigpKfGcQ1nXzJo1a/x+PmsAGGi5/vOf/zTBh8790rhxY2vMmDEmyKmtOP2ndnUrAAAANefIPiMAACByEIwAAABbEYwAAABbEYwAAABbEYwAAABbEYwAAABbEYwAAABbEYwAAABbEYwAAABbEYwAAABbEYwAAABbEYwAAACx0/8PnRRLXCarb4gAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "Y_history = pd.DataFrame(ga.all_history_Y)\n",
    "fig, ax = plt.subplots(2, 1)\n",
    "ax[0].plot(Y_history.index, Y_history.values, '.', color='red')\n",
    "Y_history.min(axis=1).cummin().plot(kind='line')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3b8bc834-1ab9-4db3-8576-920c7411a019",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.21"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
